package com.shop.admin.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.shop.po.Discount;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author banxia
 * @since 2023-02-26
 */
public interface DiscountMapper extends BaseMapper<Discount> {

    @Update("update discount set count=count+#{count} where id=#{discountId} and count+#{count}>=0")
    int changDiscountCount(@Param("discountId") Long discountId,
                           @Param("count") Long count);
}
